<?php

include 'config.php';

$result = $mysql->selectList('caution_line');

$caution_line = @$result[0]['caution_line'];
$smarty->assign("caution_line", $caution_line);


$sql1 = "SELECT s.*,n.number_name,b.breed_name,t.type_name FROM stock s left join `number` n on s.number_id=n.number_id left join breed b on s.breed_id=b.breed_id left join type t on s.type_id=t.type_id WHERE stock_num < '{$caution_line}'";
$resul = $mysql->execute($sql1);
$waring_info = array();
$a = 0;
while($rows = mysql_fetch_assoc($resul)){
	$a = $a;
	$nums = $a%2;
	$rows['nums'] = $nums;
	$waring_info[] = $rows;
	$a++;
}
$smarty->assign("caution_line_info", $waring_info);

$sql = "SELECT s.*,n.number_name,b.breed_name,t.type_name FROM stock s left join `number` n on s.number_id=n.number_id left join breed b on s.breed_id=b.breed_id left join type t on s.type_id=t.type_id WHERE 1 ORDER BY s.stock_id DESC LIMIT 0,20";
$rs = $mysql->execute($sql);
$array = array();
$n = 0;
while($row = mysql_fetch_assoc($rs)){
	$n = $n;
	$num = $n%2;
	$row['num'] = $num;
	$array[] = $row;
	$n++;
}
$smarty->assign('link', 4);
$smarty->assign('arr', $array);
$smarty->display('stock.html');